using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class TypeCoverageExceptMap : EntityTypeConfiguration<TypeCoverageExcept>
    {
        public TypeCoverageExceptMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            // Table & Column Mappings
            this.ToTable("TypeCoverageExcept");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.CoverageId).HasColumnName("CoverageId");
            this.Property(t => t.TypeId).HasColumnName("TypeId");
            this.Property(t => t.Percentage).HasColumnName("Percentage");
            this.Property(t => t.deductible).HasColumnName("deductible");
            this.Property(t => t.deductibleFlag).HasColumnName("deductibleFlag");
            this.Property(t => t.TCE_CoPay).HasColumnName("TCE_CoPay");
            this.Property(t => t.TCE_Authorization).HasColumnName("TCE_Authorization");

            // Relationships
            this.HasRequired(t => t.CoveragePlan)
                .WithMany(t => t.TypeCoverageExcepts)
                .HasForeignKey(d => d.CoverageId);
            this.HasRequired(t => t.ItemType)
                .WithMany(t => t.TypeCoverageExcepts)
                .HasForeignKey(d => d.TypeId);

        }
    }
}
